import request from "@/utils/request";
/* 文章分类列表函数 */
export const cateListApi = (obj) => {
  return request({
    url: "/my/cate/list",
    method: "get",
  });
};

/* 获取添加分类函数 */
export const addCateApi = (obj) => {
  return request({
    url: "/my/cate/add",
    method: "post",
    data: obj,
  });
};

/* 获取根据id删除分类函数 */
export const delCateByIdApi = (id) => {
  // return request({
  //   url: '/my/cate/del',
  //   method: 'delete',  //  post  get    restfulApi   delete  put
  //   params:{
  //     id:id
  //   }
  // })
  return request({
    url: "/my/cate/del?id=" + id,
    method: "delete", //  post  get    restfulApi   delete  put
  });
};

/* 编辑分类函数 */
export const editCateByIdApi = (obj) => {
  return request({
    url: "/my/cate/info",
    method: "put", //  post  get    restfulApi   delete  put
    data: obj,
  });
};

/* 编辑分类函数
delete + get 请求传参是写在params对象中的
post+ put是data中传参[请求体]
 */
export const getArtListApi = (q) => {
  return request({
    url: "/my/article/list",
    method: "get", //  post  get    restfulApi   delete  put
    params: q,
  });
};
/* 获取详情数据 */
export const getArtInfoApi = (id) => {
  return request({
    url: "/my/article/info",
    method: "get", //  post  get    restfulApi   delete  put
    params: {
      id,
    },
  });
};

/* 发布文章 */
export const pubArtApi = (obj) => {
  return request({
    url: "/my/article/add",
    method: "post", //  post  get    restfulApi   delete  put
    data: obj,
  });
};
